Implementation Notes

Issue #3 — DHCPv4 giaddr Handling & Pipeline Assembly — 2026-06-14

Design Decisions

Decision Parse/re-encode per stage for simplicity

Ambiguity: How to pass parsed DHCP message state between pipeline stages.

Choice: Each stage decodes the v4::Message from ctx.buffer, modifies it, and re-encodes back. No shared parsed state.

Rationale: Keeps PipelineContext generic (no DHCP-specific fields). The decode/encode overhead (~microseconds per message) is negligible compared to network I/O (~milliseconds). Can be optimized later by adding a parsed message cache to PipelineContext if profiling shows it matters.

Deviations

Deviation VSS stages deferred to Issue #6

Spec said: Pipeline includes Vss4Insert and Vss4Check stages.

Implemented: VSS stages are excluded from the current pipeline assembly.

Why: VSS is implemented in Issue #6. The pipeline stage definitions are ready — adding VSS will be a one-line insertion into each pipeline direction.

Tradeoffs

Tradeoff GiaddrDecision enum vs inline bool checks

Alternatives: (A) Return a decision enum; (B) Validate inline with multiple if/else returning Result.

Chose A: The enum makes the decision explicit and testable independently. Each variant maps to a clear action in the ValidateStage.

Open Questions

None — implementation followed the spec as written.